<template>
  <HModal @cancel="close" okText="确定" cancelText="取消"
          @ok="handleOK" title="撤回确定撤回?" :visible="visible">
    <InputTextArea style="min-height: 200px; height: 100%" placeholder="请输入撤回意见" v-model="comment"/>
  </HModal>
</template>
<script>
import HModal from '@/components/HModal/HModal.vue';
import {Input, notification} from 'ant-design-vue';

export default {
  name: 'WidthdrawModal',
  components: {
    HModal,
    InputTextArea: Input.TextArea
  },
  data() {
    return {
      visible: false,
      comment: undefined
    };
  },
  methods: {
    open() {
      this.visible = true;
      this.comment = undefined;
    },
    close() {
      this.visible = false;
      this.$emit('close');
      this.$nextTick(() => {
        this.comment = undefined;
      });
    },
    handleOK() {
      if (!this.comment) {
        notification.warn({message: '请输入撤回意见'})
        return;
      }

      this.$emit('ok', this.comment);
      this.close();
    },
  }
};
</script>